using System;
using System.Collections.Generic;

namespace Framework
{
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
    public class FsmActionItemAttribute : Attribute
    {
        public string Title;
        public FsmActionItemAttribute(string title = null)
        {
            Title = title;
        }
    }
    public class FsmStateAction : IFsmStateAction
    {
        public bool Finished { get; protected set; }
        public bool WatingFinish { get; set; }
        public Fsm Fsm { get; private set; }
        public void Init(Fsm fsm)
        {
            this.Fsm = fsm;
            Finished = false;
            WatingFinish = true;
            OnInit();
        }
        public void Awake()
        {
            Finished = false;
            WatingFinish = true;
            OnAwake();
        }
        public void Enter()
        {
            Finished = false;
            OnEnter();
        }
        public void Update(float deltaTime, float progress)
        {
            OnUpdate(deltaTime, progress);
            #if UNITY_EDITOR
            OnEditorUpdate(deltaTime);
            #endif
        }
        public void Exit()
        {
            OnExit();
        }
        protected virtual void OnInit()
        {

        }
        protected virtual void OnAwake()
        {

        }
        protected virtual void OnEnter()
        {

        }
        protected virtual void OnUpdate(float deltaTime, float progress)
        {

        }
        protected virtual void OnEditorUpdate(float deltaTime)
        {

        }
        protected virtual void OnExit()
        {

        }

    }
}